package com.szmg.wishwalls.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Component;

import com.szmg.common.BaseDao;
import com.szmg.wishwalls.model.Production;

@Component("productionDao")
public class ProductionDao extends BaseDao{
	/**
	 * 获取当前活动的所有产品信息
	 * @param programCode
	 * @return
	 */
	public List<Production> queryProductionByProgramCode(String programCode){
		return this.readSqlSession.selectList("com.szmg.wishwalls.dao.ProductionDao.queryProductionByProgramCode",programCode);
	}
	
	/**
	 * 获取指定节点下的所有产品
	 * @param programCode
	 * @param menuId
	 * @return
	 */
	public List<Production> queryProductionByMenuId(String programCode,String menuId){
		Map<String,String> map = new HashMap<String,String>();
		map.put("programCode", programCode);
		map.put("menuId", menuId);
		return this.readSqlSession.selectList("com.szmg.wishwalls.dao.ProductionDao.queryProductionByMenuId",map);
	}
	
	/**
	 * 获取某个心愿单对应的产品
	 * @param programCode
	 * @param menuId
	 * @return
	 */
	public List<Production> queryProductionByWishOrderId(String wishOrderId){
		return this.readSqlSession.selectList("com.szmg.wishwalls.dao.ProductionDao.queryProductionByWishOrderId",wishOrderId);
	}
	
	/**
	 * 获取指定产品信息
	 * @param productionId
	 * @return
	 */
	public Production queryProductionById(String productionId){
		return this.readSqlSession.selectOne("com.szmg.wishwalls.dao.ProductionDao.queryProductionById",productionId);
	}
}
